//
//  MainManager.m
//  Cat
//
//  Created by lushitong on 2019/1/31.
//  Copyright © 2019年 lushitong. All rights reserved.
//

#import "MainManager.h"
#import "AppDelegate.h"

@implementation MainManager

+ (MainViewController *)defaultMainVC {
	AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
	UIViewController *rootVC = appDelegate.window.rootViewController;
	return [rootVC isKindOfClass:[MainViewController class]] ? (MainViewController *)rootVC : nil;
}

/// 初始化app时添加对应tabbar红点
+ (void)addBadgeWithIndex:(TabbarIndexType)index tabBarController:(QKBaseTabBarController *)tabBarController {
	MainViewController *mainVC = [MainManager defaultMainVC];
	[mainVC updateRedPointOnTabBar:index withNumPoint:1];
}

/// 初始化app时删除对应tabbar红点
+ (void)removeBadgeWithIndex:(TabbarIndexType)index tabBarController:(QKBaseTabBarController *)tabBarController {
	MainViewController *mainVC = [MainManager defaultMainVC];
	[mainVC updateRedPointOnTabBar:index withNumPoint:0];
}

+ (void)addBadgeWithIndex:(TabbarIndexType)index {
	MainViewController *mainVC = [MainManager defaultMainVC];
	[mainVC updateRedPointOnTabBar:index withNumPoint:1];
}

+ (void)removeBadgeWithIndex:(TabbarIndexType)index {
	MainViewController *mainVC = [MainManager defaultMainVC];
	[mainVC updateRedPointOnTabBar:index withNumPoint:0];
}

@end
